package com.originalpoint.origin_server.pojo.Dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
@Schema(name = "BasePageDto" ,description = "封装着分页和模糊查询的条件")
public class BasePageDto {

    @Schema(name = "page" ,description = "页数")
    private Integer page;

    @Schema(name = "limit" ,description = "每页数据的数量")
    private Integer limit;

    @Schema(name = "startIndex" ,description = "一页数据在表中开始的位置")
    private Integer startIndex;

    @Schema(name = "name" ,description = "模糊查询的条件")
    private String name;

    public Integer getStartIndex() {
        this.startIndex=(this.page-1)*this.limit;
        return startIndex;
    }

    @Override
    public String toString() {
        return "BasePageDto{" +
                "page=" + page +
                ", limit=" + limit +
                ", startIndex=" + startIndex +
                ", name='" + name + '\'' +
                '}';
    }
}
